package org.geektimes.configuration.microprofile.converter;

import org.eclipse.microprofile.config.spi.Converter;

/**
 * @Author: jipeng
 * @Description:
 * @Date: Created in 2021/3/20 8:54
 */
public abstract class AbstractConverter<T> implements Converter<T> {

    @Override
    public T convert(String value){
        if(value == null){
            throw new NullPointerException("The value must not be null!");
        }

        return doConvert(value);
    }

    /**
     * 执行转换
     * @param value
     * @return
     */
    protected  abstract T doConvert(String value);
}
